#include <bits/stdc++.h>
using namespace std;


struct TreeNode {
    int val;
    struct TreeNode *left;
    struct TreeNode *right;
    TreeNode(int x) :
            val(x), left(NULL), right(NULL) {
    }
};
class Solution
{
public:
  void dfs(string &str, int start, set<string> &result)
  {
    if (start == str.length() - 1)
    {
      result.insert(str);
      return;
    }
    for (int i = start; i < str.size(); i++)
    {
      swap(str[i], str[start]);
      dfs(str, start + 1, result);
      swap(str[i], str[start]);
    }
  }
  vector<string> Permutation(string str)
  {
    set<string> result;
    dfs(str, 0, result);

    return vector<string>(result.begin(), result.end());
  }
};